//
//  CycleScrollView.m
//  WNZSSQ
//
//  Created by JDKJ on 2018/12/6.
//  Copyright © 2018年 JDKJ. All rights reserved.
//

#import "CycleScrollView.h"

@implementation CycleScrollView

- (void)createUI{
        
        self.backgroundColor = [UIColor whiteColor];
        
        
        //封面
        UIImageView *covImageView = [[UIImageView alloc]init];
        covImageView.image = PlaceHold;
        covImageView.contentMode = UIViewContentModeScaleAspectFill;
        covImageView.clipsToBounds = YES;
        self.covImageView = covImageView;
        [self addSubview:covImageView];
        
        //书名
        UILabel *titleLable = [[UILabel alloc]init];
        titleLable.text = @"花生中含有大量的钙元素，而人体内的钙正好就是骨骼发育所需要的重...";
        titleLable.numberOfLines = 3;
        titleLable.textColor = CSBlackColor1;
        titleLable.font = kFont17;
        self.titleLable = titleLable;
        [self addSubview:titleLable];
        
        //作者
        UILabel *nameLable = [[UILabel alloc]init];
        nameLable.text = @"相关名称";
        nameLable.textColor = CSColorFromRGB(0x6B6763);
        nameLable.font = SmallFont;
        self.nameLable = nameLable;
        [self addSubview:nameLable];
        
        UILabel *readCountLable = [[UILabel alloc]init];
        readCountLable.text = @"10.27万次阅读";
        readCountLable.textColor = CSColorFromRGB(0x6B6763);
        readCountLable.font = SmallFont;
        self.readCountLable = readCountLable;
        [self addSubview:readCountLable];
        
        
        [self setConstraints];
        
   
}

-(void)setConstraints
{
    //设置约束条件
    
    //封面
    
    [self.covImageView mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self).offset(15);
        make.left.mas_equalTo(self).offset(13);
        make.width.mas_equalTo(115);
        make.height.mas_equalTo(90);
        make.bottom.mas_equalTo(self).offset(-5);
        
    }];
    
    //书名内容
    [self.titleLable mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.top.mas_equalTo(self.covImageView);
        make.left.mas_equalTo(self.covImageView.mas_right).offset(8);
        make.right.mas_equalTo(self).offset(-15);
        
    }];
    
    //作者
    [self.nameLable mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.titleLable);
        make.bottom.mas_equalTo(self.covImageView);
        
    }];
    
    //作者
    [self.readCountLable mas_remakeConstraints:^(MASConstraintMaker *make) {
        
        make.left.mas_equalTo(self.nameLable.mas_right).offset(18);
        make.bottom.mas_equalTo(self.covImageView);
        make.right.mas_lessThanOrEqualTo(self).offset(-15);
        
    }];
    
    
    
}

@end
